home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-04-21 | 6.0 KB | 161 lines | [TEXT/MPS ] |
- //
- // DialogUtilities.h
- //
-
- #ifndef __DialogUtilities__
- #define __DialogUtilities__
-
- #ifndef __DIALOGS__
- #include <Dialogs.h>
- #endif
- #ifndef __EVENTS__
- #include <Events.h>
- #endif
- #ifndef __LISTS__
- #include <Lists.h>
- #endif
- #ifndef __MENUS__
- #include <Menus.h>
- #endif
- #ifndef __QUICKDRAW__
- #include <QuickDraw.h>
- #endif
- #ifndef __TYPES__
- #include <Types.h>
- #endif
-
- #define ESCAPE (0x1B) // ascii codes
- #define ENTER (0x03)
- #define CLEAR (0x1B)
- #define DELETE (0x08)
- #define RETURN (0x0D)
- #define TAB (0x09)
- #define ARROWL (0x1C)
- #define ARROWR (0x1D)
- #define ARROWU (0x1E)
- #define ARROWD (0x1F)
-
- #define ON_MAIN_SCREEN 0 // dialog and alert centering
- #define ON_MOUSE_SCREEN 1 //
-
- short AlertOverWindow (short alertID, ModalFilterUPP filterProc, WindowPtr parentWindow);
- DialogPtr GetNewDialogCentered (short dialogID, short whichScreen);
- DialogPtr GetNewDialogOverWindow (short dialogID, WindowPtr parentWindow);
- short AlertCentered (short id, ModalFilterUPP filterProc);
- short NoteAlertCentered (short id, ModalFilterUPP filterProc);
- short CautionAlertCentered (short id, ModalFilterUPP filterProc);
- short StopAlertCentered (short id, ModalFilterUPP filterProc);
- void ErrorMessageAlert (short id, StringPtr message, OSErr err);
- void ErrorMessageAlertOver (short id, WindowPtr parentWindow, StringPtr message, OSErr err);
- void PositionAlert (short id, Point topLeft);
- void center_alert (short alrt_id, char mode);
- void center_dialog (short dlog_id, char mode);
- GDHandle get_mouse_gdev ();
- void EnableDItem (DialogPtr, short, Boolean);
- void OutlineDItem (DialogPtr, short);
- void FlashDItem (DialogPtr, short);
- void ActivateDItem (DialogPtr, short, Boolean);
- void AdjustDCursor (DialogPtr);
- void SetDUserItem (DialogPtr theDialog, short theItem, UniversalProcPtr drawProc);
- void SetDRect (DialogPtr theDialog, short theItem, Rect *r);
- void GetDRect (DialogPtr theDialog, short theItem, Rect *r);
- void SetDText (DialogPtr, short, unsigned char*);
- void GetDText (DialogPtr, short, unsigned char*);
- void SetDCheckButton (DialogPtr, short, Boolean);
- void ToggleDCheckButton (DialogPtr, short);
- void SetDRadioButton (DialogPtr, short btn, short firstBtn, short lastBtn);
- short GetDRadioButton (DialogPtr, short firstBtn, short lastBtn);
- short GetDCtlValue (DialogPtr, short);
- void SetDCtlValue (DialogPtr, short item, short value);
- void SetDTextToNum (DialogPtr, short, long);
- long GetDTextAsNum (DialogPtr, short);
- Boolean IsCancelKeyEvent (EventRecord *event);
- Boolean IsEditKey (unsigned char c);
- Boolean IsDSelection (DialogPtr dialog);
- pascal void DrawItemLine (DialogPtr dialog, short item);
- pascal void DrawItemDoubleLine (DialogPtr dialog, short item);
- pascal void DrawItemRect (DialogPtr dialog, short item);
- pascal void DrawItemLineGray (DialogPtr dialog, short item);
- pascal void DrawItemRectGray (DialogPtr dialog, short item);
-
- void MovableDialog (ModalFilterProcPtr filterProc, short *itemHit);
- pascal Boolean StandardFilter (DialogPtr whichDialog, EventRecord *event, short *itemHit);
- pascal Boolean StandardModalFilter (DialogPtr whichDialog, EventRecord *event, short *itemHit);
-
- //
- // list utilities
- //
-
- ListHandle ListCreate (WindowPtr window, Rect *frame, Boolean allowMultipleSelections);
- void ListDraw (ListHandle list);
- Boolean ListFilter (ListHandle list, EventRecord *event, DialogPtr listDialog, short listItem, short dblClickItem, short *itemHit);
- Boolean ListClick (ListHandle list, EventRecord *event, Boolean *doubleClicked);
- Boolean ListKey (ListHandle list, EventRecord *event);
- void ListInsertRowAt (ListHandle list, unsigned char *text, short row);
- void ListAddRow (ListHandle list, unsigned char *text);
- void ListDeleteRow (ListHandle list, short row);
- void ListGetRow (ListHandle list, short row, unsigned char *text);
- void ListSetRow (ListHandle list, short row, unsigned char *text);
- void ListSetSelection (ListHandle list, short row);
- void ListSetSelectionByText (ListHandle list, unsigned char *text, Boolean exactMatchOnly);
- Boolean ListGetFirstSelection (ListHandle list, short *row);
- Boolean ListGetNextSelection (ListHandle list, short *row);
- Boolean ListFindRow (ListHandle list, unsigned char *text, Boolean exactMatchOnly, short *row);
-
- Boolean ListFindRowSorted (ListHandle list, unsigned char *text, short *row);
- void ListAddRowSorted (ListHandle list, unsigned char *text);
-
- //
- // popup menu utilities
- //
-
- #define kStandardPopup 0
- #define kTriangleOnlyPopup 1
-
- typedef struct pop
- {
- short choice;
- short menuID;
- MenuHandle hMenu;
- Rect bounds;
- short style;
- Boolean isVisible;
- } Popup;
-
- Popup* PopupNew (short popupStyle, short menuID, short choice, Rect *bounds);
- void PopupDelete (Popup *pop);
- void PopupDraw (Popup *pop);
- Boolean PopupClick (Popup *pop, EventRecord *event);
- Boolean PopupFilter (Popup *pop, DialogPtr popDialog, EventRecord *event);
- short PopupGetChoice (Popup *pop);
- void PopupSetChoice (Popup *pop, short choice);
- void PopupGetChoiceText (Popup *pop, unsigned char *text);
- short PopupSetChoiceToMatchText (Popup *pop, unsigned char *text);
- short PopupGetItemCount (Popup *pop);
- void PopupInsertItem (Popup *pop, unsigned char *text, short aterItem);
- void PopupDeleteItem (Popup *pop, short item);
- Boolean PopupGetVisible (Popup *pop);
- void PopupSetVisible (Popup *pop, Boolean isVisible);
-
- //
- // password utilities
- //
-
- pascal Boolean PasswordFilter (DialogPtr dialog, EventRecord *event, short *itemHit, short passwordItem, unsigned char *password);
-
- // misc stuff
-
- void NoResAlert( ConstStr255Param theText, ConstStr255Param theErr );
-
- #if USESROUTINEDESCRIPTORS
- #define UPP(pp) ((UniversalProcPtr)&rd##pp)
- #define UPPInit(info,pp) RoutineDescriptor rd##pp = BUILD_ROUTINE_DESCRIPTOR(info,pp);
- #define UPPInitStatic(info,pp) static RoutineDescriptor rd##pp = BUILD_ROUTINE_DESCRIPTOR(info,pp);
- #else
- #define UPP(pp) (pp)
- #define UPPInit(info,pp)
- #define UPPInitStatic(info,pp)
- #endif
-
- #endif __DialogUtilities__
-